﻿@{
    ViewBag.Title = "" + FOResource.UI.CpanelLayout.mngbanner + "";
    Layout = "~/Views/Shared/_CpanelLayout.cshtml";
}
<script type="text/javascript">
    $(document).ready(function () {
        $(".active-tab").removeClass("active-tab");
        $("a[rel=rel-ads]").parent().parent().css("display", "block");
        $("a[rel=rel-ads]").parent().parent().prev().addClass("active-tab");
        $("a[rel=rel-ads]").addClass("active-tab");
    });
    </script>
 <script type="text/javascript">
     $(document).ready(function () {
       
         var url = "/BannerSlideShow/getSlideJson";
         var rowID = 0;
         var source = {
             datatype: "json",
             datafields: [
                                { name: 'SShowID' },
                                { name: 'Title' },
                                { name: 'Images' },
                                { name: 'Target' },
                                { name: 'Links' },
                                { name: 'Enable', type: 'bool' },
                                { name: 'OrderSort' },
             ],
             id: 'SShowID',
             url: url
         };
         var imagerenderer = function (row, datafield, value) {
             return '<img style="margin:10px;10px;10px;10px;" height="50" width="150" src="/content/images/' + value + '"/>';
         }
         var cellsrenderer = function (row, columnfield, value, defaulthtml, columnproperties) {

             return '<span style="margin: 5px;font-weight:bold; float: ' + columnproperties.cellsalign + '; color: #2069b4;">' + value + '</span>';

         }
         var benefit = function (row, columnfield, value, defaulthtml, columnproperties) {

             return '<span style="margin-top:5px;margin-left:10px;display: block;text-align:left !important;">' + value + '</span>';

         }
         var furture = function (row, columnfield, value, defaulthtml, columnproperties) {

             return '<span style="margin-top:5px;margin-left:10px;display: block;text-align:left !important;">' + value + '</span>';

         }

         $("#grid_news").jqxGrid({
             width: '100%',
             source: source,
             rowsheight: 70,
             autoheight: true,
             pageable: true,
             sortable: true,
             altrows: true,
             enabletooltips: true,
             selectionmode: 'multiplecellsadvanced',
             columns: [
            { text: 'ID', datafield: 'SShowID', width: 55 },
            { text: '@FOResource.UI.CpanelLayout.title', datafield: 'Title', width: 355},
            { text: '@FOResource.UI.CpanelLayout.img', datafield: 'Images', width: 170, cellsrenderer: imagerenderer },
            { text: '@FOResource.UI.CpanelLayout.url', datafield: 'Links', width: 250 },
            { text: 'Target', datafield: 'Target', width: 100 },
            { text: '@FOResource.UI.CpanelLayout.display', columntype: 'checkbox', datafield: 'Enable' },
            { text: '@FOResource.UI.CpanelLayout.numberlist', datafield: 'OrderSort', width: 100 },

            {
                text: 'Edit', datafield: 'Edit', columntype: 'button', width: 70, cellsrenderer: function () {
                    return "Edit";
                }, buttonclick: function (editrow) {

                    var dataRecord = $("#grid_news").jqxGrid('getrowdata', editrow);

                    window.location = "/BannerSlideShow/UpdateSlide/" + dataRecord.SShowID;


                }
            },



            {
                text: 'Remove', datafield: 'Delete', columntype: 'button', width: 70, cellsrenderer: function () {
                    return "Delete";
                }, buttonclick: function (editrow) {

                    var comfim = confirm("@FOResource.UI.CpanelLayout.confimdelete");
                    if (comfim) {
                        var dataRecord = $("#grid_news").jqxGrid('getrowdata', editrow);
                        $.ajax({
                            type: "POST",
                            url: "/BannerSlideShow/DeleteSlide",
                            datatype: "json",
                            data: { SShowID: dataRecord.SShowID },
                            success: function (result) {
                                if (result["Status"] == "OK") {
                                    alert("@FOResource.UI.CpanelLayout.deletesuccess");
                                    $("#grid_news").jqxGrid({ source: source });
                                }
                                else {

                                    alert("@FOResource.UI.CpanelLayout.deletesuccess");
                                }
                            }
                        });
                    }


                }
            }
             ]
         });

     });

</script>
<div class="content-module-heading cf">
					
						<h3 class="fl">@FOResource.UI.CpanelLayout.mngbanner</h3>
							<span class="fr expand-collapse-text">@FOResource.UI.CpanelLayout.minimize</span>
						<span class="fr expand-collapse-text initial-expand">@FOResource.UI.CpanelLayout.expand</span>
					
					</div> <!-- end content-module-heading -->
					
					
					<div class="innerLR">
<div id="grid_news"></div>
                        </div>